package com.novelot.plugin.allinone.setting;

import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBTextField;
import com.intellij.util.ui.FormBuilder;

import javax.swing.JComponent;
import javax.swing.JPanel;

/**
 * Supports creating and managing a {@link JPanel} for the Settings Dialog.
 */
public class AppSettingsComponent {

    private final JPanel myMainPanel;
    private final JBTextField tfHanisdkDir = new JBTextField();
    private final JBTextField tfMomoDir = new JBTextField();

    public AppSettingsComponent() {
        myMainPanel = FormBuilder.createFormBuilder()
                .addLabeledComponent(new JBLabel("hanisdk路径: "), tfHanisdkDir, 1, false)
                .addLabeledComponent(new JBLabel("momo路径: "), tfMomoDir, 1, false)
                .addComponentFillVertically(new JPanel(), 0)
                .getPanel();
    }

    public JPanel getPanel() {
        return myMainPanel;
    }

    public JComponent getPreferredFocusedComponent() {
        return tfHanisdkDir;
    }

    public String getMomoDir() {
        return tfMomoDir.getText();
    }

    public void setMomoDir(String newText) {
        tfMomoDir.setText(newText);
    }

    public String getHanisdkDir() {
        return tfHanisdkDir.getText();
    }

    public void setHanisdkDir(String hanisdkDir) {
        tfHanisdkDir.setText(hanisdkDir);
    }

}
